package com.xiaobaibai.units;

import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Last7DaysUtil {

    public static String getNowDay(){
        return DateFormatUtils.format(new Date(), "MM/dd");
    }

    //启发自己写的
    public static List<String> getRecent7Day(){
        List<String> list=new ArrayList<>();
        Date date=new Date();
        for(int i=6;i>=0;i--){
            Date d = DateUtils.addDays(date, -i);
            String mMdd = DateFormatUtils.format(d, "MM/dd");
            list.add(mMdd);
        }
        return list;
    }

}
